﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Text;
using Tauren.Business.Entity.Const;

namespace Tauren.Business.Mapper
{
    /// <summary>
    /// 常用参数映射
    /// </summary>
    public class ParametersProfile : Profile, ICommProfile
    {
        public ParametersProfile()
        {
            InitProfile();
        }

        public void InitProfile()
        {
            CreateMap<Entity.Model.Parameters, Entity.Output.Parameters_OutPut>().AfterMap((data, viw) =>
            {
                viw.Dic_Creatdate = data.Creatdate is null ? "" : data.Creatdate.Value.ToString(GlobalConst.DATE_FORMAT_SECONDS);
                viw.Dic_Modifdate = data.Modifdate is null ? "" : data.Modifdate.Value.ToString(GlobalConst.DATE_FORMAT_SECONDS);
            });
            CreateMap<Entity.Input.Parameters_InPut, Entity.Model.Parameters>();
            CreateMap<Entity.Model.ParameterValue, Entity.Output.ParameterValue_OutPut>().AfterMap((data, viw) =>
            {
                viw.Dic_Creatdate = data.Creatdate is null ? "" : data.Creatdate.Value.ToString(GlobalConst.DATE_FORMAT_SECONDS);
                viw.Dic_Modifdate = data.Modifdate is null ? "" : data.Modifdate.Value.ToString(GlobalConst.DATE_FORMAT_SECONDS);
            });
            CreateMap<Entity.Input.ParametersValue_IntPut, Entity.Model.ParameterValue>();
        }
    }
}
